/**
 * @file: bitset.cpp 
 * Easy example of c++ code
 */
/**
 * Copyright 2011 MIPT-COMPILER team
 */

#pragma once 


#include <iostream>
#include <sstream>


class OutOfRangeException
{
public:
    OutOfRangeException( unsigned ireal, unsigned imax);
    ~OutOfRangeException() {};
    std::string data();
private:
    unsigned real, max;
};


class BitSet
{
public:
    BitSet( unsigned inp_num_of_bits);
    ~BitSet();

    char getBit( unsigned bit_num);
    void setBit( unsigned bit_num, bool bit_value);
    const std::string serialize();
    friend std::ostream& operator << (std::ostream& cout_, BitSet& obj);

private:
    char* first_byte;
    unsigned num_of_bits;
};

